<?php
!defined('QAPP') AND exit('Forbidden');
$webserver = "";
//dumpForInstall($_SERVER);
if (stripos(strtolower(@$_SERVER['SERVER_SOFTWARE']), 'nginx') > -1) {
    $webserver = "Nginx";
} elseif (stripos(strtolower(@$_SERVER['SERVER_SOFTWARE']), 'apache') > -1) {
    $webserver = "Apache";
} elseif (stripos(strtolower(@$_SERVER['SERVER_SOFTWARE']), 'iis/6') > -1) {
    $webserver = "IIS6";
} elseif (stripos(strtolower(@$_SERVER['SERVER_SOFTWARE']), 'iis') > -1) {
    $webserver = "IIS";
} else {
    $webserver = "其他Web服务软件";
}

if (getGet("checkok") == 1) {
    session_set("step", 40);
    header("location:?step=40");
}
?>
<div class="panel panel-default" id="webserver">
    <div class="panel-heading">伪静态检测</div>
    <div class="panel-body">
        <p>
            Web服务：<span class="label-default label"><?php echo $webserver; ?></span>
        </p>
        <p>
            是否已经配置了伪静态：<span id="checking"><i class="label-default label">正在检查...约需10秒</i></span> <a
                    class="btn btn-default btn-xs" href="?step=30&recheck=1">重新检测</a>
        </p>

        <p>
            伪静态可以优化SEO及给用户一个清洁的URL展示，QAPP要求配置web服务器的伪静态。
        </p>
        <p>
            <b>web服务的伪静态配置后，请重启web服务</b>
        </p>
    </div>
</div>

<div id="next" style="display: none">
    <p style="margin: 30px;text-align: center;">
        <a class="btn btn-primary" href="?step=30&checkok=1">下一步，数据库配置</a>
    </p>
</div>
<iframe id="rewriteiframe" src="../rewritetest<?php rand(100, 999) ?>.html" style="display:none"></iframe>
<script>
    function setrewrite() {
        var rewriteurl = document.getElementById("rewriteiframe").contentWindow.location.href;
        if (rewriteurl.indexOf("install") > 0) {
            document.getElementById("checking").innerHTML = "<b class='label label-success'>已配置</b>"
            document.getElementById("next").style.display = "block"
        } else {
            document.getElementById("checking").innerHTML = "<b class='label label-danger'>未配置，请根据<a href='https://gitee.com/withu2018/qapp/docs#doc5' target='_blank'>《伪静态配置说明》</a>进行配置</b>"
        }
    }

    setTimeout(function () {
        setrewrite()
    }, 3000);

    setTimeout(function () {
        setrewrite()
    }, 6000);

    setTimeout(function () {
        setrewrite()
    }, 9000);
</script>


